package com.nana.petadventure.app
{
	import com.nana.framework.debug.Debug;

	public class AppData
	{
		private static var _instance:AppData;
		
		private var _flashValue:Object;
		public var myID:String = "283486848";
		public var isDebug:Boolean = false;
		public var friendListVersion:String = "1";
		public var inviteUrl:String = "";
		public var platform:String = "lp_qq";
		public var userIsNew:Boolean = true;
		public var userFrom:String = "";
		public var socketPort:String = "12302";
		public var socket:String = "192.168.1.211";
		public var facebookApiKey:String = "";
		public var facebookSS:String = "";
		public var facebookSessionkey:String = "230397963";
		public var sessionkey:String;
		public var action:String = "";
		public var isFan:int = 0;
		public var statisticsUrl:String = "http://xn.lp.fminutes.com/api_flash_statistics.php?inuId=";
		public var postUrl:String;
		
		public function AppData(){
			this.sessionkey = this.myID;
			this.postUrl = "http://xnapi.lp.fminutes.com/api.php?uId=" + this.myID + "&method=";
			if (_instance == null){
				super();
				_instance = this;
				this.setValue(PlatformFlashValue.value);
			} else {
				throw (new Error("实例化单例类出错-AppData"));
			}
		}
		
		public static function getInstance():AppData{
			if (_instance == null){
				_instance = new AppData();
			}
			return _instance;
		}
		
		public function setValue(_arg1:Object):void{
			this._flashValue = _arg1;
			if (_arg1.hasOwnProperty("userid")){
				this.myID = _arg1["userid"];
			}
			if (_arg1.hasOwnProperty("action")){
				this.action = _arg1["action"];
			}
			if (_arg1.hasOwnProperty("inuId")){
				this.sessionkey = _arg1["userid"];
			}
			if (_arg1.hasOwnProperty("session_key")){
				this.facebookSessionkey = _arg1["session_key"];
			}
			if (_arg1.hasOwnProperty("ss")){
				this.facebookSS = _arg1["ss"];
			}
			if (_arg1.hasOwnProperty("api_key")){
				this.facebookApiKey = _arg1["api_key"];
			}
			if (_arg1.hasOwnProperty("host")){
				this.socket = _arg1["notificationIp"];
			}
			if (_arg1.hasOwnProperty("port")){
				this.socketPort = _arg1["notificationPort"];
			}
			if (_arg1.hasOwnProperty("userFrom")){
				this.userFrom = _arg1["userFrom"];
			}
			if (_arg1.hasOwnProperty("userIsNew")){
				this.userIsNew = _arg1["userIsNew"];
			}
			if (_arg1.hasOwnProperty("platform")){
				this.platform = _arg1["platform"];
			}
			if (_arg1.hasOwnProperty("inviteUrl")){
				this.inviteUrl = _arg1["inviteUrl"];
			}
			if (_arg1.hasOwnProperty("postUrl")){
				this.postUrl = _arg1["postUrl"];
			}
			if (_arg1.hasOwnProperty("friendlistVer")){
				this.friendListVersion = _arg1["friendlistVer"];
			}
			if (_arg1.hasOwnProperty("isFan")){
				this.isFan = _arg1["isFan"];
			}
			Debug.log(("myID:" + this.myID + "\naction:" + this.action + "" + "\nsessionkey:" + this.sessionkey + "" + "\nfacebookSessionkey:" + this.facebookSessionkey + "") + "\nfacebookSS:" + this.facebookSS + "" + "\nfacebookApiKey:" + this.facebookApiKey + "" + "\nsocket:" + this.socket + "" + "\nsocketPort:" + this.socketPort + "" + "\nuserFrom:" + this.userFrom + "" + "\nuserIsNew:" + this.userIsNew + "" + "\nplatform:" + this.platform + "" + "\ninviteUrl:" + this.inviteUrl + "" + "\npostUrl:" + this.postUrl + "" + "\nfriendListVersion:" + this.friendListVersion + "" + "\nisFan:" + this.isFan), "xyz");
		}
		
		public function getValue(_arg1:String, _arg2:String=null):Object{
			if (this._flashValue == null){
				return (_arg2);
			}
			return (((this._flashValue[_arg1]) || (null)));
		}
		
		public function get platformNamespace():String{
			return (Platform.getInstance().platform);
		}
		
		public function get platformOutResName():String{
			switch (this.platform){
				case "lp_en":
					return ("en");
				case "lp_tw":
					return ("tw");
				case "lp_kx":
					return ("kx");
				case "lp_xn":
					return ("xn");
				case "lp_4399":
					return ("4399");
				case "lp_ybg":
					return ("ybg");
				case "lp_mixi":
					return ("mx");
				case "lp_my":
					return ("my");
				case "lp_vz":
					return ("vz");
				case "lp_ok":
					return ("ok");
				case "lp_tb":
					return ("tb");
				case "lp_qq":
					return ("qq");
			}
			return ("xn");
		}
	}
}